package main

import "fmt"

func reverseWords(s string) string {
	var word, res string
	for key, value := range s {
		if value == ' ' && s[key-1] != ' ' {
			word = s[:key]
			fmt.Println("word=", word)
		}
		res = word + " " + res
	}
	fmt.Println("res=", res)
	return res
}
func main() {
	reverseWords("hello world  hello  world")
}
